
#include "rrCintamaniAPI.h"

#ifndef H_rrCintamaniDOM
#define H_rrCintamaniDOM

class rrCintamaniElementStyle
{
public :
	rrCintamaniElementStyle( const FB::DOM::ElementPtr & style );
	~rrCintamaniElementStyle();
	void SetBackground( const std::string & Colour );
	void SetWidth( const std::string & Width );
	void SetHeight( const std::string & height );
	void SetDisplay( const std::string & Display );
	void SetFontSize( const std::string & FontSize );
	void SetMarginTop( const std::string & top );
	void SetPaddingTop( const std::string & top );
	void SetProperty( const std::string & prop, const std::string & val ) ;
private :
	FB::DOM::ElementPtr mStyle;
};

class rrCintamaniElement : public FB::JSAPIAuto
{
public :
	rrCintamaniElement( const FB::DOM::ElementPtr & Ele);
	~rrCintamaniElement();
	FB::DOM::DocumentPtr GetOwnerDocument() const;
	FB::JSObjectPtr GetJSObject() const;
	void AppendChild( rrCintamaniElementPtr child );
	void GetElementsByTagName(const std::string &name, std::vector<rrCintamaniElementPtr> & tagList ) const;
	void SetInnerHtml( const std::string & html ) ;
	std::string GetInnerHtml( ) const ;
	std::string GetTextContent( ) const ;
	void SetTextContent(const std::string & textContent);
	std::string GetTagName() const;
	std::string GetId() const ;
	void SetId(const std::string & Id);
	std::string GetClassName() const;
	void SetClassName(const std::string & className) ;
	void SetName(const std::string & name);
	void SetNodeName(const std::string & nodeName) ;
	bool HasAttribute( const std::string & attributename );
	std::string GetAttribute( const std::string & attributename ) const;
	void SetAttribute( const std::string & name, const std::string & value) ;
	//virtual void CreateEventCallback( ElementCallBackType Type, const FB::JSAPIPtr & pt );
virtual void AddEventListener( const std::string name, const FB::JSAPIPtr & pt );
	rrCintamaniElementStylePtr GetStyle() const ;
	void AddListener( rrCintamaniElementCallback * Listener );
	virtual void OnClick();
	virtual void OnTouchStart();

protected :
	FB::DOM::ElementPtr mElement;
	std::vector<rrCintamaniElementCallback*> mListeners;
};


class rrCintamaniElementVideo : public rrCintamaniElement
{
public :
	rrCintamaniElementVideo( const FB::DOM::ElementPtr & Ele );
	~rrCintamaniElementVideo();
	void Initialize( const std::string & url );
	void AddEventListener( const std::string name , const FB::JSAPIPtr & pt ) ;
	void Stop();
	void OnResize();
	void OnClick();
private :
	std::string mClassName;
};


#endif